package Entity;

import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;

import VOs.StockVO;

@Entity
public class Stock {
	@Id
	private long id;
	@Column(name = "\"NAME\"")
	private String name;
	private String symbol;
	private String description;
	@ManyToOne
	private Company company;
	@OneToMany(mappedBy = "stock")
	private List<Quote> quotes;
	
	public StockVO tovo(){
		StockVO vo = new StockVO();
		vo.setDescription(getDescription());
		vo.setId(getId());
		vo.setName(getName());
		vo.setSymbol(getSymbol());
		vo.setCompany(getCompany());
		vo.setQuotes(getQuotes());
		
		return vo;
	}

	public long getId() {
		return id;
	}

	public void setId(long id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getSymbol() {
		return symbol;
	}

	public void setSymbol(String symbol) {
		this.symbol = symbol;
	}

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public Company getCompany() {
		return company;
	}

	public void setCompany(Company company) {
		this.company = company;
	}

	public List<Quote> getQuotes() {
		return quotes;
	}

	public void setQuotes(List<Quote> quotes) {
		this.quotes = quotes;
	}

}
